package Util;

import jade.core.AID;
import jade.lang.acl.ACLMessage;
import jade.lang.acl.MessageTemplate;

import java.util.Iterator;
import java.util.List;

public class myMatchExpression implements MessageTemplate.MatchExpression {
	List senders;

	public myMatchExpression(List l){
		senders = l;
	}

	public boolean match(ACLMessage msg){
		AID sender = msg.getSender();
		String name = sender.getName();
		Iterator it_temp = senders.iterator();
		boolean out = false;
		while(it_temp.hasNext() && !out){
			String tmp = ((AID)it_temp.next()).getName();
			if(tmp.equalsIgnoreCase(name))
				out = true;
		}
		return out;
	}
}